package net.aiform.template.dao.impl;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import net.aiform.template.dao.TemplateDao;
import net.aiform.template.pojo.Template;

import org.apache.log4j.Logger;
import org.springframework.transaction.annotation.Transactional;

@Transactional
public class TemplateDaoJPA implements TemplateDao {
	private Logger log = Logger.getLogger(this.getClass());
	private EntityManager em;

	@Override
	public void save(Template template) {
		log.info("save template:" + template);
		em.merge(template);
	}

	public EntityManager getEntityManager() {
		return em;
	}

	@PersistenceContext
	public void setEntityManager(EntityManager em) {
		this.em = em;
	}
}
